package com.bestcem.xm.om.dao.impl;

import com.bestcem.xm.om.dao.UserDomainDao;
import com.bestcem.xm.om.dao.mapper.UserDomainMapper;
import com.bestcem.xm.om.entity.UserDomain;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @author zhangfeng <feng.zhang@idiaoyan.com>
 * @version v1.0
 * @date 2022/6/22 14:48
 */
@Slf4j
@Repository
public class UserDomainDaoImpl implements UserDomainDao {
    @Resource
    private UserDomainMapper userDomainMapper;

    @Override
    public UserDomain queryById(String id) {
        return userDomainMapper.queryById(id);
    }

    @Override
    public List<UserDomain> queryAllByLimit(UserDomain userDomain) {
        return userDomainMapper.queryAllByLimit(userDomain);
    }

    @Override
    public long count(UserDomain userDomain) {
        return userDomainMapper.count(userDomain);
    }

    @Override
    public int insert(UserDomain userDomain) {
        return userDomainMapper.insert(userDomain);
    }

    @Override
    public int insertBatch(List<UserDomain> entities) {
        return userDomainMapper.insertBatch(entities);
    }

    @Override
    public int insertOrUpdateBatch(List<UserDomain> entities) {
        return userDomainMapper.insertOrUpdateBatch(entities);
    }

    @Override
    public int update(UserDomain userDomain) {
        return userDomainMapper.update(userDomain);
    }

    @Override
    public int deleteById(String id) {
        return userDomainMapper.deleteById(id);
    }

    @Override
    public List<UserDomain> listByIds(List<String> ids) {
        if(CollectionUtils.isEmpty(ids)) {
            return Collections.emptyList();
        }
        return userDomainMapper.listByIds(ids);
    }

    @Override
    public List<UserDomain> listDomain() {
        return userDomainMapper.listDomain();
    }

    @Override
    public UserDomain findOneByCode(String domainCode) {
        return userDomainMapper.findOneByCode(domainCode);
    }

    @Override
    public int updateByCode(UserDomain existDomain) {
        return userDomainMapper.updateByCode(existDomain);
    }
}


